﻿using System;
using System.Windows.Forms;

namespace PocketGPW
{
    /// <summary>
    /// Form extenstions.
    /// </summary>
    internal static class FormExtensions
    {
        private static string _baseCaption = "Pocket GPW";
        
        /// <summary>
        /// Pokazuje poprawnie dialog z ukryciem parenta w Menedżerze zadań.
        /// </summary>
        /// <param name="dialog"></param>
        /// <param name="parent"></param>
        /// <param name="caption"></param>
        /// <returns></returns>
        internal static DialogResult ShowDialog(this Form dialog, Form parent, string caption)
        {
            dialog.Text = _baseCaption + caption; // ustawiamy caption na oknie
            parent.Text = String.Empty; // kasujemy cation parenta aby zniknął z listy

            DialogResult result = dialog.ShowDialog();

            parent.Text = _baseCaption; // zwracamy caption

            return result;
        }
    }
}
